<template>
	<view class="myInviteTeachers-page">
		<head-box></head-box>
		<z-paging ref="paging" class="zpaging"  @query="queryList" :list.sync="dataList" >
		<view class="myInviteTeachers-page-main">

			<view class="myInviteTeachers-page-main-item" v-for="(item, index) in dataList" :key="index">
				<view class="myInviteTeachers-page-main-item-header">
					<view class="_item-header-title"><text>{{item.name}}</text></view>
				</view>

				<view class="myInviteTeachers-page-main-item-content">
					<view class="myInviteTeachers-page-main-item-content-inner">

						<view class="_content-inner-detail">
							<view class="_content-inner-detail-item">
								<view class="_content-inner-detail-item-info">
									<view class="lables">公司名称：{{item.applyUnit}}</view>
									<view class="lables">预约时间：{{item.timez}}</view>
									<view class="lables">阵地用途：{{item.serviceDemand}}</view>
									<view class="lables">参与人数：{{item.useNumber}}人</view>
									<!-- <view class="lables">状态：{{item.approvalResultText}}</view> -->
									<view class="lables">阵地地址：{{item.possyAddress}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="myInviteTeachers-page-main-item-bottom">
					<view class="myInviteTeachers-page-main-item-bottom-text"><text><text class="pf"><img src="/static/img/fen.png" v-for="(item1,index1) in item.commentStar" :key="index1" /></text></text></view>
					<view class="myInviteTeachers-page-main-item-bottom-text">
						<view :class="item.approvalResultClass">{{item.approvalResultText}}</view>
					</view>
				</view>
			</view>

		</view>
		</z-paging>
		<tabs-box></tabs-box>
	</view>
</template>

<script>
	import {mygetFrontList} from '@/common/request.js';
		import customrefresher from "@/components/custom-refresher/custom-refresher";
	export default {
		components: {
			customrefresher
		},
		data() {
			return {
				dataList:[],
			};
		},
    onShow(){
      // #ifdef H5
      console.log('分享')
      this.$wxSetShare()
      // #endif
    },
		methods: {
			queryList(pageNo, pageSize) {
				mygetFrontList(pageNo,pageSize).then(res => {
					if(res.success)
					{
						//this.total = res.result.records.length;
						let List = []
						res.result.records.forEach(ele => {
							ele["approvalResultClass"] = this.GetTypeClass(ele.approvalResult)
							ele["approvalResultText"] = this.GetTypeText(ele.approvalResult)
							ele["timez"] = this.pjtime(ele.useStartTime,ele.useEndTime)
							List.push(ele);
						})
						console.log(res.result.records)
						//let list = res.result.records;
						this.$refs.paging.addData(List);
					}
				});
			},
			GetTypeClass(value){
				if(value=="" || value =="0")
					return "front_type front_dsh";
				else if(value=="1")
					return "front_type front_tg";
				else if(value=="-1")
					return "front_type front_error";
				else if(value=="-2")
					return "front_type front_error";
				else
					return "front_type front_error";
			},
			GetTypeText(value)
			{
				if(value=="" || value =="0")
					return "待审核";
				else if(value=="1")
					return "审批通过";
				else if(value=="-1")
					return "审批不通过";
				else if(value=="-2")
					return "取消审批";
				else
					return "未知";
			},
			pjtime(stattime,endtime)
			{
				let time1 = this.set_time(stattime);
				let time2 = this.set_time(endtime);
				console.log(time1,time2);
				let times2 = time2.split(' ');
				return time1 + " ~ " + times2[1]
			},
			set_time(str){
			  var n = parseInt(str);
			  var D = new Date(n);
			  var year = D.getFullYear();//四位数年份

			  var month = D.getMonth()+1;//月份(0-11),0为一月份
			  month = month<10?('0'+month):month;

			  var day = D.getDate();//月的某一天(1-31)
			  day = day<10?('0'+day):day;

			  var hours = D.getHours();//小时(0-23)
			  hours = hours<10?('0'+hours):hours;

			  var minutes = D.getMinutes();//分钟(0-59)
			  minutes = minutes<10?('0'+minutes):minutes;

			  // var seconds = D.getSeconds();//秒(0-59)
			  // seconds = seconds<10?('0'+seconds):seconds;
			  // var week = D.getDay();//周几(0-6),0为周日
			  // var weekArr = ['周日','周一','周二','周三','周四','周五','周六'];

			  var now_time = year+'-'+month+'-'+day+' '+ hours + ':'+minutes;
			  return now_time;
			}
		}
	}
</script>

<style lang="scss">
	.front_type{
		font-size: 24rpx;
		color: #FFFFFF;
		padding: 2rpx 15rpx;
		border-radius: 24rpx;
	}
	.front_dsh{
		background-color: #ff8b2b;
	}
	.front_tg{
		background-color: #19d800;
	}
	.front_error{
		background-color: #da3a29;
	}
	.myInviteTeachers-page{
		width: 100%;
		box-sizing: border-box;
		padding-bottom: 200rpx;
		background-color: #efeff4;
		line-height: 42rpx;
		height: 100vh;
		.zpaging{
			height: 100%
		}
		.top-fixed{
			position: fixed;
			top: 0;
			z-index: 1;
		}
		.top{
			width: 100%;
			height:100rpx;
			padding:0 30rpx;
			// background-color: #007AFF;
			background-color: #f7f7f7;
			box-shadow: 0 1px 6rpx #ccc;
			display:flex;
			justify-content:space-between;
			align-items: center;
			box-sizing: border-box;
			.top-text{
				color:#000;
				font-size:34rpx;
			}
		}
		.top-box{
			width: 100%;
			height: 100%;
			position: relative;
			text-align: center;
			line-height: 100rpx;
			.back-img{
				width:44rpx;
				height:40rpx;
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				margin:auto;
				margin-left: 0rpx;
			}
		}
		.myInviteTeachers_select{
			padding: 30rpx 30rpx 0 30rpx;
			font-size: 32rpx;
			display: flex;
			flex-direction: row;
			.myInviteTeachers_select-lable{
				margin-top: 15rpx;
			}
			.myInviteTeachers_select_item{
				color: #000;
				width: 200rpx;
				border: 1px solid #cccccc;
				border-radius: 10rpx;
				padding: 10rpx 20rpx;
				background-color: #ffffff;
				font-size: 30rpx;
				.drop-dowm-img{
					width: 30rpx;
					height: 30rpx;
					margin-left: 10rpx;
					float: right;
				}
			}
		}
		.myInviteTeachers-page-main{
			width: 100%;
			padding: 0 20rpx;
			box-sizing: border-box;
			.myInviteTeachers-page-main-item{
				width: 100%;
				border-radius: 4rpx;
				background-color: white;
				background-clip: padding-box;
				box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
				margin-top: 30rpx;
				.myInviteTeachers-page-main-item-header{
					position: relative;
					display: -webkit-box;
					display: -webkit-flex;
					display: flex;
					min-height: 88rpx;
					padding: 20rpx 30rpx;
					box-sizing: border-box;
					-webkit-box-pack: justify;
					-webkit-justify-content: space-between;
					justify-content: space-between;
					-webkit-box-align: center;
					-webkit-align-items: center;
					align-items: center;
					font-size: 34rpx;
					border-radius: 4rpx 4rpx 0 0;
					border-bottom: 1px solid rgba(200,199,204,0.5);
					._item-header-title{

					}
				}
				.myInviteTeachers-page-main-item-content{
					font-size: 28rpx;
					position: relative;
					.myInviteTeachers-page-main-item-content-inner{
						position: relative;
						padding: 30rpx;
						box-sizing: border-box;
						display: flex;
						flex-wrap: nowrap;
						justify-content: flex-start;
						._content-inner-img{
							width: 160rpx;
							height: 160rpx;
							border-radius: 10rpx;
							._img{
								width: 100%;
								height: 100%;
								border-radius: 10rpx;
							}
						}
						._content-inner-detail{
							._content-inner-detail-item{
								._content-inner-detail-item-badge{
									margin-left: 20rpx;
									._content-inner-detail-item-badge-text{
										margin: 0 10rpx;
										font-size: 24rpx;
										padding: 10rpx 20rpx;
										background-color: #F0AD4E;
										color: #fff;
										border-radius: 40rpx;
										box-sizing: border-box;
									}
								}
								._content-inner-detail-item-info{
									padding: 0 0 0 20rpx;
									box-sizing: border-box;
									.lables{
										padding-left: 0rpx;
									}
								}
							}
						}
					}
				}
				.myInviteTeachers-page-main-item-bottom{
					position: relative;
					display: -webkit-box;
					display: -webkit-flex;
					display: flex;
					min-height: 88rpx;
					padding: 20rpx 30rpx;
					box-sizing: border-box;
					-webkit-box-pack: justify;
					-webkit-justify-content: space-between;
					justify-content: space-between;
					-webkit-box-align: center;
					-webkit-align-items: center;
					align-items: center;
					border-top: 1px solid rgba(200,199,204,0.5);
					.myInviteTeachers-page-main-item-bottom-text{
						color: #6d6d72;
						border-radius: 0 0 4rpx 4rpx;
						font-size: 28rpx;
						.pf{
							img{
								width: 40rpx;
							}
						}
					}
				}
			}
		}

		.r10{margin-right: 10rpx;}
	}
</style>
